#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    int main()
    {
        int current = 0;
        int deposit = 0;
        for(int i=1;i<=12;++i)
        {
            int budget;
            cin >> budget;
            current += 300;
            if(current < budget)
            {
                cout << -i;
                return 0;
            }
            else
            {
                current -= budget;
                if(current >= 100)
                {
                    deposit += 100 * (current / 100);
                    current %= 100;
                }
            }
        }
        current += deposit * 12 / 10;
        cout << current;
        return 0;
    }
};

#ifndef __LOCAL_TEST__
int main()
{
    return Solution().main();
}
#endif